package dao

import (
	"go-task/common"
	"gorm.io/driver/sqlite"
	"gorm.io/gorm"
)

var (
	DB *gorm.DB
)

func InitDB(config *common.ConfigFile) {
	db, err := gorm.Open(sqlite.Open(config.Sqlite.Path), &gorm.Config{})
	if err != nil {
		panic("failed to connect database")
	}
	db = db.Debug()
	DB = db
}
